#pragma once
#include "stdafx.h"
#include "Mesh.h"
#include "Effect.h"
#include "Animation.h"
#include "RenderObject.h"

/*
Description of model:
	name: name of this model
	mesh: an mesh use in this model, different model could share same mesh.
	desc: descript this model is unmoveable, moveable or animation
*/

class RenderObject;
class Resource;
class Effect;

struct ModelInfo
{
	ModelInfo()
		:speed(0.0f),
		anim(0),
		pos(XMFLOAT3(0.0f,0.0f,0.0f))
	{
	}
	float speed;
	int anim;
	XMFLOAT3 pos;
};

class Model : public RenderObject, public Resource
{
private:
	Model();

public:
	typedef boost::shared_ptr<Model> sPtr;
	typedef boost::shared_ptr<Mesh> MeshPtr;
	typedef boost::shared_ptr<ModelInfo> ModelInfoPtr;
	
	Model(string,MeshPtr,ModelInfoPtr,RenderMode);
	~Model(void);
	
	void AddedToObject();
	void InitModel();
	XMMATRIX GetWorldMatrix();
	void CalcAnim(const int);
	
private:
	MeshPtr m_mesh;
	ModelInfoPtr m_modelInfo;
	Animation::sPtr m_anim;
	XMMATRIX m_worldMatrix;

};

